package com.aspose.cells;

import java.io.IOException;
import java.io.InputStream;

/** @deprecated */
public class LightCells {
   private String[] a;
   private String b;
   private com.aspose.cells.b.a.d.zm c;

   public static LightCells getInstance(String file) {
      LightCells var1 = new LightCells();
      var1.b = file;
      return var1;
   }

   public static LightCells getInstance(InputStream stream) throws IOException {
      LightCells var1 = new LightCells();

      try {
         var1.c = new com.aspose.cells.b.a.d.zh(stream);
         return var1;
      } catch (IOException var3) {
         throw var3;
      } catch (Exception var4) {
         throw new IOException(var4.getMessage());
      }
   }

   private void a() throws Exception {
      LoadOptions var1 = new LoadOptions();
      var1.b(0);
      Workbook var2;
      if (this.b != null) {
         var2 = new Workbook(this.b, var1);
      } else {
         var2 = new Workbook(this.c, var1);
      }

      this.a = new String[var2.getWorksheets().getCount()];

      for(int var3 = 0; var3 < this.a.length; ++var3) {
         this.a[var3] = var2.getWorksheets().get(var3).getName();
      }

   }

   public int getSheetCount() throws Exception {
      if (this.a == null) {
         this.a();
      }

      return this.a.length;
   }

   public String getSheetName(int sheetIndex) throws Exception {
      if (this.a == null) {
         this.a();
      }

      return this.a[sheetIndex];
   }

   public void processWorkbook(CellHandler cellHandler) throws Exception {
      LoadOptions var2 = new LoadOptions();
      var2.b(0);
      var2.setLightCellsDataHandler(new zfy(cellHandler, -1));
      Workbook var3;
      if (this.b != null) {
         var3 = new Workbook(this.b, var2);
      } else {
         var3 = new Workbook(this.c, var2);
      }

      if (this.a == null) {
         this.a = new String[var3.getWorksheets().getCount()];

         for(int var4 = 0; var4 < this.a.length; ++var4) {
            this.a[var4] = var3.getWorksheets().get(var4).getName();
         }
      }

   }

   private void a(LightCellsDataHandler var1) throws Exception {
      LoadOptions var2 = new LoadOptions();
      var2.b(0);
      var2.setLightCellsDataHandler(var1);
      Workbook var3;
      if (this.b != null) {
         var3 = new Workbook(this.b, var2);
      } else {
         var3 = new Workbook(this.c, var2);
      }

      if (this.a == null) {
         this.a = new String[var3.getWorksheets().getCount()];

         for(int var4 = 0; var4 < this.a.length; ++var4) {
            this.a[var4] = var3.getWorksheets().get(var4).getName();
         }
      }

   }

   public void processWorksheet(String sheetName, CellHandler cellHandler) throws Exception {
      this.a(new zfy(cellHandler, sheetName));
   }

   public void processWorksheet(int sheetIndex, CellHandler cellHandler) throws Exception {
      this.a(new zfy(cellHandler, sheetIndex));
   }

   public void release() {
      this.c = null;
      this.b = null;
      this.a = null;
   }
}
